<%@ page import="main.www.wonderfuldata.com.StatementTest" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="main.www.wonderfuldata.bean.User2" %>
<%@ page import="main.www.wonderfuldata.bean.bookInfo" %>
<%@ page import="main.www.wonderfuldata.com.User" %>
<%@ page import="com.mysql.cj.Session" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: gby0564
  Date: 2022/4/26
  Time: 22:49
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>

    <title>Title</title>
    <link rel="stylesheet" href="CSS/table.css">
    <script src="JS/updateBookInfo.js"></script>
    <link rel="stylesheet" href="">


    <style>
        table {
            align-self: center;
            border-collapse: collapse;
            border: none;
        }
    </style>


</head>
<body>

    <%
        String path = request.getContextPath();
        String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>


    <%
        String sql = "select *from User";
        StatementTest st = new StatementTest();
        List<User2> list2  = st.getAllInstance(User2.class,sql);

        request.setAttribute("list2", list2);




    %>


<!--
    <b>遍历List集合的全部元素：</b>
    <br>
    <c:forEach items="${requestScope.list2}" var="keyword" varStatus="id">
        ${id.index} ${keyword} ${keyword.name}${keyword.password}<br>
    </c:forEach>
    <br>
    <b>遍历List集合中第一个元素以后的元素（不包括第一个元素）：</b>
    <br>
    <c:forEach items="${requestScope.list2}" var="keyword" varStatus="id" begin="1">
        ${id.index} ${keyword} ${keyword.name}${keyword.password}<br>
    </c:forEach>

-->
    <br>
    <br>
    <br>
    <br>


<table align="center" >
    <tr>
        <td>name</td>
        <td>password</td>
        <td>用户姓名</td>
        <td>用户密码</td>
        <td>修改信息</td>
    </tr>

    <c:forEach items="${requestScope.list2}" var="keyword" varStatus="id" begin="1">
        <tr>
            <td>${id.index}</td>
            <td>${keyword}</td>
            <td>${keyword.name}</td>
            <td>${keyword.password}</td>
            <td>
                <button  type="button" >修改信息</button>
            </td>
        </tr>
    </c:forEach>


</table>


        <%
            String sqlSelectBoonInfo ="SELECT * FROM bookInfo";
            StatementTest st2 = new StatementTest();
            List<bookInfo> listBookInfo  = st2.getAllInstance(bookInfo.class,sqlSelectBoonInfo);
            request.setAttribute("listBookInfo", listBookInfo);




        %>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>



    <table align="center" id="one-column-emphasis" summary="2007 Major IT Companies' Profit">

        <colgroup>
            <col class="oce-first" />
        </colgroup>
        <thead>
        <tr>
            <td>bookId</td>
            <td>bookName</td>
            <td>authpr</td>
            <td>bookPages</td>
            <td>publishingHouse</td>
            <td>category</td>
        </tr>
        </thead>
            <tbody>
        <c:forEach items="${requestScope.listBookInfo}" var="keyword" varStatus="id">

            <tr>

                <td>${keyword.bookId}</td>
                <td>${keyword.bookName}</td>
                <td>${keyword.author}</td>
                <td>${keyword.bookPages}</td>
                <td>${keyword.publishingHouse}</td>
                <td>${keyword.category}</td>


                <%





                %>
                <td>
                    <button id="${keyword.bookId}" type="button" onclick="delectBookInfo(id)">删除</button>
                </td>
            </tr>

        </c:forEach>
            </tbody>

    </table>

</body>
</html>
